Window3 = fgui.window_class();

function Window3:ctor()

end

function Window3:OnInit()
	self.contentPane = UIPackage.CreateObject("RenderTexture", "TestWin").asCom;
	self:SetXY(200, 50);

	self._renderImage = RenderImage.New(self.contentPane:GetChild("holder").asGraph);
	-- RenderImage是不透明的，可以设置最多两张图片作为背景图
	self._renderImage:SetBackground(self.contentPane:GetChild("frame").asCom:GetChild("n0"), self.contentPane:GetChild("n20"));

	self.contentPane:GetChild("btnLeft").onTouchBegin:Add(self.__clickLeft, self);
	self.contentPane:GetChild("btnRight").onTouchBegin:Add(self.__clickRight, self);
end

function Window3:OnShown()
	self._renderImage:LoadModel("Role/npc");
	self._renderImage.modelRoot.localPosition = Vector3(0, -1.0, 5);
	self._renderImage.modelRoot.localScale = Vector3(1, 1, 1);
	self._renderImage.modelRoot.localRotation = Quaternion.Euler(0, 120, 0);

end

function Window3:__clickLeft()
	self._renderImage:StartRotate(-2);
	Stage.inst.onTouchEnd:Add(self.__touchEnd, self);
end

function Window3:__clickRight()
	self._renderImage:StartRotate(2);
	Stage.inst.onTouchEnd:Add(self.__touchEnd, self);
end

function Window3:__touchEnd()
	self._renderImage:StopRotate();
	Stage.inst.onTouchEnd:Remove(self.__touchEnd);
end
